package com.enjoy.aop.dynamicProxy.cglib;


import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class HelloInterceptor implements MethodInterceptor {


    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {

        System.out.println(method.getName()+"进入前置通知---HelloInterceptor");
        Object r = methodProxy.invokeSuper(o, objects);
        System.out.println(method.getName()+"进入后置通知---HelloInterceptor");
        return r;
    }
}
